Troubleshooting
Crash: java.lang.ClassNotFoundException: androidx.datastore.preferences.PreferenceDataStoreDelegateKt
Problem:
You may encounter the following crash at runtime:
java.lang.ClassNotFoundException: androidx.datastore.preferences.PreferenceDataStoreDelegateKt
Solution:
This issue usually occurs when the Android Gradle Plugin (AGP) version is outdated. To resolve this:
-
Run the Android Studio Upgrade Assistant
- Open your project in Android Studio.
- Go to
Tools
>AGP Upgrade Assistant
. - Follow the prompts to upgrade your project.
-
Update AGP to at least version 8.6.0
- Open your project’s
build.gradle
(Project-level) file. - Update the AGP dependency to version 8.6.0 or higher:
dependencies {
classpath 'com.android.tools.build:gradle:8.6.0'
} - Sync your project with Gradle files.
- Open your project’s
After upgrading, rebuild your project. The crash should be resolved.